package com.ecoolex.ying.space.ws;

import com.ecoolex.framework.common.exception.BizException;
import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.framework.common.pojo.Sorting;
import com.ecoolex.ying.space.core.manager.UserFavoriteManager;
import com.ecoolex.ying.space.entity.UserFavorite;
import com.ecoolex.ying.space.pojo.AddUserFavoriteDTO;

import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;


@Service
public class UserFavoriteServiceImpl implements UserFavoriteService {

    @Autowired
    UserFavoriteManager userFavoriteManager;

    @Override
    public UserFavorite getUserFavoriteByIdAndUserId(Integer userId, Integer favoriteId) {
        return userFavoriteManager.getByIdAndUserId(userId, favoriteId);
    }

    @Override
    public Pagination<UserFavorite> queryUserFavoriteList(Integer userId, Sorting[] sorts, Page page) {
        return userFavoriteManager.queryUserFavoriteList(userId, sorts, page);
    }

    @Override
    public UserFavorite addUserFavorite(Integer userId, AddUserFavoriteDTO add, String createUser) throws BizException {
        return userFavoriteManager.add(userId, add, createUser);
    }

    @Override
    public UserFavorite editUserFavorite(UserFavorite record, String updateUser) throws BizException {
        return userFavoriteManager.edit(record, updateUser);
    }

    @Override
    public void deleteUserFavorite(UserFavorite record, String updateUser) throws BizException {
        userFavoriteManager.delete(record, updateUser);
    }

    @Override
    public void setPublic(UserFavorite record, String updateUser) throws BizException {
        userFavoriteManager.setPublic(record, updateUser);
    }

    @Override
    public void cancelPublic(UserFavorite record, String updateUser) throws BizException {
        userFavoriteManager.cancelPublic(record, updateUser);
    }

}
